package com.zdd.ehe.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zdd.ehe.entity.NewsData;
import com.zdd.ehe.entity.Role;
import com.zdd.ehe.mapper.NewsDataMapper;
import com.zdd.ehe.service.INewsDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ZhuiZhu
 * @since 2023-03-24
 */
@Service
public class NewsDataServiceImpl extends ServiceImpl<NewsDataMapper, NewsData> implements INewsDataService {
    @Resource
    private NewsDataMapper newsDataMapper;

    /**
     * 分页查询新闻列表
     *
     * @param page
     * @return
     */
    @Override
    public Page<NewsData> getAllNewsByPage(Page<NewsData> page) {
        Page<NewsData> pagex = newsDataMapper.getAllNewsByPage(page);
        return pagex;
    }

    @Override
    public int addNewsData(NewsData newsData) {
        return newsDataMapper.insert(newsData);
    }

    @Override
    public int updateNewsDataById(NewsData newsData) {
        return newsDataMapper.updateById(newsData);
    }
}
